﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace RainyPWS.Web.Admin.controls
{
    public partial class Title : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            UpdateIconStyle();
        }

        private IconType _icon = 0;
        public IconType Icon
        {
            set { _icon = value;}
        }

        public string Text
        {
            get { return lblTitle.Text; }
            set { lblTitle.Text = value; }
        }

        private void UpdateIconStyle()
        {
            switch (_icon)
            {
                case IconType.Record:
                    lblTitle.Style.Add("background-image", "/admin/images/record.png");
                    break;
                case IconType.Tool:
                    lblTitle.Style.Add("background-image", "/admin/images/tool.png");
                    break;
                case IconType.Game:
                    lblTitle.Style.Add("background-image", "/admin/images/game.png");
                    break;
                case IconType.Home:
                default:
                    lblTitle.Style.Add("background-image", "/admin/images/home.png");
                    break;
            }
        }

        public enum IconType
        {
            Home,
            Record,
            Tool,
            Game
        }
    }
}